

#pragma once

#include "zrxdefs.h"
#include "zacadstrc.h"

#pragma pack (push, 8)

class UcRxProtocolReactor;
class UcRxProtocolReactorIterator;
class UcRxProtocolReactorList;
class UcRxProtocolReactorListIterator;
class UcRxProtocolReactorManager;
class UcRxProtocolReactorManagerFactory;

class ZSOFT_NO_VTABLE UcRxProtocolReactor : public UcRxObject
{
public:
    UCRX_DECLARE_MEMBERS(UcRxProtocolReactor);
};

class ZSOFT_NO_VTABLE UcRxProtocolReactorIterator : public UcRxObject
{
public:
    UCRX_DECLARE_MEMBERS(UcRxProtocolReactorIterator);
    virtual UcRxClass* reactorClass () const = 0;
    virtual void start() = 0;
    virtual bool next () = 0;
    virtual bool done () const = 0;
    virtual UcRxProtocolReactor* object () const = 0;
};

class ZSOFT_NO_VTABLE UcRxProtocolReactorList : public UcRxObject
{
public:
    UCRX_DECLARE_MEMBERS(UcRxProtocolReactorList);
    virtual UcRxClass* reactorClass() const = 0;
    virtual Ucad::ErrorStatus addReactor   (UcRxProtocolReactor* pReactor) = 0;
    virtual void              removeReactor(UcRxProtocolReactor* pReactor) = 0;
    virtual UcRxProtocolReactorIterator* newIterator () const = 0;
};

class ZSOFT_NO_VTABLE UcRxProtocolReactorListIterator : public UcRxObject
{
public:
    UCRX_DECLARE_MEMBERS(UcRxProtocolReactorListIterator);
    virtual void start() = 0;
    virtual bool next () = 0;
    virtual bool done () const = 0;
    virtual UcRxProtocolReactorList* object () const = 0;
};

class ZSOFT_NO_VTABLE UcRxProtocolReactorManager: public UcRxObject
{
public:
    UCRX_DECLARE_MEMBERS(UcRxProtocolReactorManager);
    virtual UcRxProtocolReactorList* createReactorList (
                                         UcRxClass* pReactorClass) = 0;
    virtual UcRxProtocolReactorListIterator* newIterator () const = 0;
};

class ZSOFT_NO_VTABLE UcRxProtocolReactorManagerFactory : public UcRxService
{
public:
    UCRX_DECLARE_MEMBERS(UcRxProtocolReactorManagerFactory);
    virtual UcRxProtocolReactorManager* createReactorManager (
                                        UcRxClass* pRxClass) const = 0;
};

#define ucrxProtocolReactors \
UcRxProtocolReactorManagerFactory::cast(ucrxServiceDictionary-> \
                                        at(UCRX_PROTOCOL_REACTOR_MANAGER))

#define UCRX_PROTOCOL_REACTOR_MANAGER_AT(ucrxClass) \
ucrxProtocolReactors->createReactorManager(ucrxClass)

#define UCRX_PROTOCOL_REACTOR_LIST_AT(ucrxClass, reactorClass) \
    UCRX_PROTOCOL_REACTOR_MANAGER_AT(ucrxClass)->createReactorList(reactorClass)

#pragma pack (pop)
